<?php
namespace App\Modules\Health\Models;

use App\Models\HealthNote;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;

class Meridian extends Model
{
    use HasDateTimeFormatter;

    protected $table = 'health_meridian';

    protected $primaryKey = 'id';

    protected $fillable = [
        'name', // 名称
        'abbr_name', // 简称
        'img', // 图片路径
        'status', // 状态 1-正常 0-禁用
        'details_img', // 详情图片
        'time_desc', // 时段
        'xxlx', // 循行路线
        'zhuzhi', // 主治
    ];

    public function acu()
    {
        return $this->hasManyThrough(Acupoint::class, AcuMeridian::class, 'meridian_id', 'id', 'id', 'acu_id');
    }

    public function note()
    {
        return $this->morphMany(HealthNote::class, 'belong');
    }
}
